package main

import (
	"fmt"
	"io"
	"net/http"
)

func main() {
	//http.HandleFunc("/", HelloHandler)
	//http.ListenAndServe(":8000", nil)
	requestTest()
}

func HelloHandler(w http.ResponseWriter, r *http.Request) {
	fmt.Fprintf(w, "hello world")
}

func requestTest() {
	resp, err := http.Get("https://jsonplaceholder.typicode.com/posts/1")
	if err != nil {
		fmt.Println("Error:", err)
		return
	}
	defer resp.Body.Close()

	body, err := io.ReadAll(resp.Body)
	if err != nil {
		fmt.Println("Error reading response body:", err)
		return
	}

	fmt.Println("Response from server:", string(body))
}
